<?php
namespace app\controller;

use app\BaseController;
use zmoyi\JuShuiTan\Api\ApiRequest;
use zmoyi\JuShuiTan\Api\Common\ServeHttp;

class Index extends BaseController
{
    public function index()
    {
        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">16载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
    }

    public function hello($name = 'ThinkPHP6')
    {
        $config = [
            'authUrl' => 'https://openweb.jushuitan.com/auth',
            'baseUrl' =>'https://dev-api.jushuitan.com/',
            'app_Key' => 'b0b7d1db226d4216a3d58df9ffa2dde5',
            'app_Secret'=> '99c4cef262f34ca882975a7064de0b87',
            'access_token' => 'b7e3b1e24e174593af8ca5c397e53dad'
        ];
        // dump(date('Y-m-d h:s:m'));die;
        $data = [
            [
                    "shop_id"=>10394268,
                    "so_id"=>"fujun2001",
                    "order_date"=>date('Y-m-d h:s:m'),//订单时间
                    "shop_status"=>"WAIT_SELLER_SEND_GOODS",
                    "shop_buyer_id"=>"2022060601",//买家帐号 长度 <= 50
                    "receiver_state"=>"Kuala Lumpur",
                    "receiver_city"=>"Kuala Lumpur",
                    "receiver_district"=>"Kuala Lumpur",
                    "receiver_address"=>"No 170 Jalan Sepakat 2 United Garden 58200 kl",
                    "receiver_name"=>"Dorisneoh",
                    "receiver_phone"=>"0126692533",
                    "receiver_zip"=>"58200",
                    "pay_amount"=>0,
                    "freight"=>0,
                    "remark"=>"KCL",
                    "buyer_message"=>"KCL",//买家留言 长度<=400；可更新
                    "shop_modified"=>"2022-03-10 15:24:13",
                    "l_id"=>"MM210000578",
                    "logistics_company"=>"其它",
                    "labels"=>"B2",
                    "lc_id"=>"OTHER",
                    "items"=>[
                        [
                            "sku_id"=>"2021031920158541",
                            "shop_sku_id"=>"2021031920158541",
                            "amount"=>0,
                            "base_price"=>0,
                            "qty"=>2,
                            "name"=>"【1箱40包】采琪采Queen系列本色抽纸 小包纸巾",
                            "outer_oi_id"=>"443110",
                            "batch_id"=> "17",
                            "produced_date"=> "2022-08-19"
                        ]
                    ],
                    "pay"=>[
                        "outer_pay_id"=>"OONP2021031920213476",
                        "pay_date"=>date('Y-m-d h:s:m'),//支付时间
                        "payment"=>"memall",
                        "seller_account"=>"memall",
                        "buyer_account"=>"0126692533",
                        "amount"=>0
                    ],
                    "ext_datas"=>[
                        "company_name"=>"公司名",
                        "door_plate"=>"门牌号"
                    ],
                    "order_ext"=>[
                        "tracking_no"=>"国际运单号",
                        "pdf_url"=>"PDF面单地址",
                        "datas"=>[
                            [
                                "AutoId"=>"自增ID",
                                "Iid"=>"款式编码",
                                "SkuId"=>"商品编码",
                                "SkuCode"=>"商品Code",
                                "Name"=>"商品名称",
                                "DeclareNameZN"=>"报关中文名称",
                                "DeclareNameEN"=>"报关英文名称",
                                "DeclareAmount"=>"报关商品单价",
                                "DeclareWeight"=>"报关商品重量",
                                "HsCode"=>"海关编码",
                                "PostTaxNum"=>"行邮税号",
                                "IsBattery"=>"是否带电",
                                "IsLiquid"=>"是否液体",
                                "IsDisable"=>"是否禁用",
                                "Creator"=>"创建人",
                                "Created"=>"创建时间",
                                "Modifier"=>"修改人",
                                "Modified"=>"修改时间",
                                "Unit"=>"单位",
                                "isSetSkubin"=>"是否拼接仓位",
                                "IsJoinSkuid"=>"是否拼接商品编码",
                                "IsPaste"=>false,
                                "IsMagnetic"=>"是否带磁",
                                "IsFluid"=>"是否液体",
                                "IsGetPrice"=>"是否取实际售价",
                                "IsGetWeight"=>"是否取实际重量",
                                "SpecialAttr"=>"特殊属性",
                                "Country"=>"通用",
                                "TempName"=>"模板名称",
                                "TempId"=>"模板ID",
                                "IsDefault"=>"是否默认",
                                "ShopId"=>"店铺编码",
                                "IsOAmount"=>"是否整单金额",
                                "Cid"=>"类目ID",
                                "IsPowder"=>"是否是粉末",
                                "IsSpecialCargo"=>"是否特货",
                                "IsJoinSkubin"=>"是否拼接吃馕为",
                                "SaveType"=>"保存类型",
                                "DeclareType"=>"报关类别"
                            ]
                        ]
                    ],
                    "finance_data"=>[
                        "rebate_fee"=>100,
                        "product_tax"=>1,
                        "shipping_tax"=>1,
                        "other_income"=>400,
                        "voucher_from_seller"=>102,
                        "platform_commission"=>2,
                        "transition_fee"=>6,
                        "transaction_fee"=>4,
                        "opaque_bagging_fee"=>1,
                        "other_expense"=>50
                    ]
                
            ]
            
        ]; 
        $apiRequest = new ApiRequest($config);
        /**
        * ServeHttp::XXX为内部定义的接口路由常量
        * 也可以直接传路由地址，如：/open/orders/out/simple/query
        */
        $response = $apiRequest->request(ServeHttp::UPLOAD_ORDERS,$data);

        dump($response );die;
        return 'hello,' . $name;
    }
}
